﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace IosDecode
{
    public partial class Form1 : Form
    {
        /// <summary>
        /// 文件保持路径
        /// </summary>
        private string SavePath { get; set; }

        public Form1()
        {
            InitializeComponent();

        }

        /// <summary>
        /// 读取文件并且解密
        /// </summary>
        /// <param name="file">文件路径，需要带有后缀名</param>
        private void DecodeAndSave(string file)
        {
            using (var fsRead = new FileStream(file, FileMode.Open))
            {
                var fsLen = (int)fsRead.Length;
                var heByte = new byte[fsLen];
                var r = fsRead.Read(heByte, 0, heByte.Length);

                var str = Encoding.UTF8.GetString(heByte);
                var val = NewDecode.ToDecode(str);
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            var file = new OpenFileDialog();
            if (file.ShowDialog() != DialogResult.OK) return;
            DecodeAndSave(file.FileName.Trim());
        }


    }
}
